home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Freelog 125
/
Freelog_MarsAvril2015_No125.iso
/
Musique
/
Quod Libet
/
quodlibet-3.3.0-installer.exe
/
bin
/
quodlibet
/
ext
/
events
/
automask.pyc
(
.txt
)
< prev
next >
Wrap
Python Compiled Bytecode
|
2014-12-31
|
2KB
|
49 lines
# Source Generated with Decompyle++
# File: in.pyc (Python 2.7)
import os
import gi
gi.require_version('Gio', '2.0')
from gi.repository import Gio
from quodlibet import app
from quodlibet.plugins.events import EventPlugin
class AutoMasking(EventPlugin):
PLUGIN_ID = 'automask'
PLUGIN_NAME = _('Automatic Masking')
PLUGIN_DESC = _('Automatically mask and unmask drives when they are unmounted or mounted.')
PLUGIN_VERSION = '0.1'
__sigs = None
__monitor = None
def enabled(self):
if self._AutoMasking__monitor is None:
self._AutoMasking__monitor = Gio.VolumeMonitor.get()
self._AutoMasking__sigs = [
self._AutoMasking__monitor.connect('mount-added', self._AutoMasking__mounted),
self._AutoMasking__monitor.connect('mount-removed', self._AutoMasking__unmounted)]
else:
for signal_id in self._AutoMasking__sigs:
self._AutoMasking__monitor.handler_unblock(signal_id)
def disabled(self):
for signal_id in self._AutoMasking__sigs:
self._AutoMasking__monitor.handler_unblock(signal_id)
def __mounted(self, monitor, mount):
path = mount.get_default_location().get_path()
if path is not None:
app.library.unmask(os.path.normpath(path))
def __unmounted(self, monitor, mount):
path = mount.get_default_location().get_path()
if path is not None:
app.library.mask(os.path.normpath(path))